home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(Key.isDown(37) && _root.dispensing == false)
- {
- walking = true;
- if(_root.jake._x > 80)
- {
- _root.jake.gotoAndStop("j_walkLeft");
- _root.jake._x -= jakeSpeed;
- }
- }
- else if(Key.isDown(39) && _root.dispensing == false)
- {
- walking = true;
- if(_root.jake._x < 600)
- {
- _root.jake.gotoAndStop("j_walkRight");
- _root.jake._x += jakeSpeed;
- }
- }
- else if(Key.isDown(32))
- {
- walking = false;
- if(_root.hitTill.hitTest(_root.jake.hit))
- {
- action = "till";
- }
- else if(_root.hitDis.hitTest(_root.jake.hit))
- {
- action = "dispenser";
- }
- }
- else if((Key.isDown(97) || Key.isDown(98) || Key.isDown(99) || Key.isDown(100) || Key.isDown(101) || Key.isDown(102) || Key.isDown(103) || Key.isDown(104) || Key.isDown(105) || Key.isDown(49) || Key.isDown(50) || Key.isDown(51) || Key.isDown(52) || Key.isDown(53) || Key.isDown(54) || Key.isDown(55) || Key.isDown(56) || Key.isDown(57)) && _root.hitRack.hitTest(_root.jake.hit))
- {
- numberKey = String.fromCharCode(Key.getAscii());
- trace("***************" + numberKey + "*********************");
- action = "fill";
- walking = false;
- }
- else
- {
- walking = false;
- action = "";
- actionFilled = false;
- actionServed = false;
- actionCollected = false;
- _root.jake.gotoAndPlay(1);
- }
- if(action == "fill" && actionFilled == false)
- {
- if(_root.currentSweet > 0 && numberKey != "")
- {
- updateRack(numberKey,_root.currentSweet);
- actionFilled = true;
- }
- }
- if(action == "till" && actionServed == false && _root.currentSweet < 0)
- {
- serveTill();
- actionServed = true;
- }
- if(action == "dispenser" && actionCollected == false && _root.currentSweet < 0)
- {
- _root.dispensing = true;
- dispenseSweet();
- actionCollected = true;
- }
- }
-